import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: jiume
 * Date: 2025-03-02
 * Time: 16:12
 */
public class Demo {

    public static void main(String[] args) {
        // 填充验证码数组
        char[] ch = new char[62];
        int k = 0;
        for (char i = 'a'; i <= 'z'; i++) {
            ch[k++] = i;
        }
        for (char i = 'A'; i <= 'Z' ; i++) {
            ch[k++] = i;
        }
//        for (char i = 0; i < 10; i++) {
//            ch[k++] = i;
//        }
        for (char i = '0'; i <= '9' ; i++) {
            ch[k++] = i;
        }

        // 随机生成验证码
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 4; i++) {
            builder.append(ch[new Random().nextInt(62)]);
        }

        System.out.println("随机生成的验证码: "+builder.toString());

    }
}
